-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
errors: move non-frame error types to scylla crate and adjust their visibility #1074
Conversation
See the following report for details: cargo semver-checks output
|
b298a89
to
09735bc
Compare
Let's retain module path compatibility for now (i.e., please stick to |
3cd3611
to
cf46893
Compare
Done. I did it in a separate commit at the end. I hope it's acceptable, since rebasing and moving contents of each commit to other file would be a tedious work... |
cf46893
to
08fb8e6
Compare
aecf9a1
to
3ecb7f0
Compare
v1.1:
|
Currently, most of the error types are contained in scylla-cql crate. This makes it much harder to make some errors pub(crate) (re-exporting is required). In addition, some error types, such as `QueryError` and `NewSessionError` should not belong to scylla-cql crate. They belong to public API and should be defined in `scylla` crate.
In addition, marked it as non_exhaustive.
In addition, marked it as non_exhaustive.
We want to move `UserRequestError` to scylla crate. To achieve this, we cannot have any places in `scylla-cql` crate that would depend on this error's definition. Fortunately, there was only one place that needed it. To fix it, we simply narrow the return type of the method and introduce a From<> implementation for the transition. This way, we do not have to adjust the callers (that use `?` operator).
This error type is used only for driver's internal error management. It's not intended to be exposed to users.
The only reason it was firstly defined in `scylla-cql` is because `QueryError` and `NewSessionError` were defined there - they directly depend on this type. This is no longer true, since we moved both of these errors to scylla crate.
Again, it was defined in scylla-cql crate because ConnectionPoolError directly depends on it.
3ecb7f0
to
c1c172b
Compare
Rebased on main. |
v1.2: addressed @Lorak-mmk comments
|
I see you introduced a new method:
I believe it should not be present.
|
Makes sense, I'll remove it. |
Changed the name from `get_inner()` to `get_reason()`.
This error type is intended for driver's use only.
In addition, marked it as `non_exhaustive`.
AddrParseError does not include an information about the string that we tried to parse. This is why we include it in our error type.
In addition, marked it as non_exhaustive.
In addition, marked it as non_exhaustive.
It should not belong to errors module.
It should not belong to errors module.
The only error type (and its dependencies) that was left in this module was DbError type. It directly corresponds to `response::error::Error` type. I think the `response::error` module is a great place to put it there. We re-export this type in scylla crate, so it can be found in the same place as other error types (scylla::errors, previously scylla::transport::errors). We can also now remove the scylla-cql::errors module altogether.
…n]Error This is now included in `BrokenConnectionErrorKind`. Corresponding variant in [Query/NewSession]Error is never constructed.
043e73f
to
0720d4b
Compare
Done |
Originally, all errors could be found under scylla::transport::errors. Let's retain the same path.
0720d4b
to
601417c
Compare
v1.3: fixed a docstring comment of |
Ref: #519
Depends on #1067
Motivation
Most of the error types defined in
scylla-cql::errors
module should not belong there. Only 3 types are directly used inscylla-cql
crate (DbError
,OperationType
andWriteType
). The rest can be safely moved toscylla
crate. It would allow us to modify the visibility of error types much easier. In scylla-cql crate, all error types need to be public - we would need to adjust their pub-visibility via re-exporting in scylla crate which is a tedious work. In addition, it does not make much sense for e.g.QueryError
to reside inscylla-cql
.Changes
scylla_cql::errors
toscylla::errors
moduleUserRequestError
,pub(crate)
DbError
,OperationType
andWriteType
types toframe::response::error
module. There is no need for additionalscylla_cql::errors
module just for themscylla_cql::errors
module altogetherTranslationError
Questions
Q: In result, the users can now find non-frame error types under
scylla::errors
instead ofscylla::transport::errors
. I'm not sure whether it's a good change or not. Should I move theerrors
module toscylla::transport
module, so we don't introduce too many API breaking changes for the users?A: We decided to retain the original path. I'm moving the
errors
module toscylla::transport
in last commit.Pre-review checklist
[ ] I added relevant tests for new features and bug fixes.[ ] I have adjusted the documentation in./docs/source/
.Fixes:
annotations to PR description.